<template>
  <div class="p-2">
    <el-card>
      <template #header>
        <div class="card-header">
          <span>企业：{{ form.name }}</span>
        </div>
      </template>
      <el-collapse v-model="activeName" class="border_top_0">
        <el-collapse-item title="基础信息" name="1">
          <div class="row">
            <div class="col">
              <div class="label">
                企业名称：
              </div>
              <div class="value"> {{ form.name||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                企业简称：
              </div>
              <div class="value"> {{ form.nameNc||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                支付通道：
              </div>
              <div class="value">
                <dict-tag
                  :options="pay_channel"
                  :value="form.passage"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                统一社会信用代码：
              </div>
              <div class="value"> {{ form.nsrSbh||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                法人姓名：
              </div>
              <div class="value"> {{ form.fr||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                法人身份证号：
              </div>
              <div class="value"> {{ form.frSfz||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                法人手机号：
              </div>
              <div class="value"> {{ form.frSjh||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                经办人姓名：
              </div>
              <div class="value"> {{ form.wtr||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                经办人身份证号码：
              </div>
              <div class="value"> {{ form.wtrSfz||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                经办人电话：
              </div>
              <div class="value"> {{ form.wtrSjh||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                经办人邮箱：
              </div>
              <div class="value"> {{ form.wtrEmail||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                区域：
              </div>
              <div class="value"> {{ form.unitAreaName||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                实际经营地址：
              </div>
              <div class="value"> {{ form.address||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                所属行业：
              </div>
              <div class="value"> {{ form.industry||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                营业执照有效期：
              </div>
              <div class="value"> {{ form.yyzzTime||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                法人身份证有效期：
              </div>
              <div class="value"> {{ form.frCardidTime||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                经办人身份证有效期：
              </div>
              <div class="value"> {{ form.jbrCardidTime||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                业务员：
              </div>
              <div class="value"> {{ form.ywyId||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                注册资本：
              </div>
              <div class="value"> {{ form.registeredAssets||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                注册时间：
              </div>
              <div class="value"> {{ form.regdate||'' }} </div>
            </div>

          </div>
        </el-collapse-item>
        <el-collapse-item title="账户信息" name="2">
          <div class="row">
            <div class="col">
              <div class="label">
                账户名称：
              </div>
              <div class="value"> {{ form.khm||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                开户银行：
              </div>
              <div class="value"> {{ form.khh||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                开户行：
              </div>
              <div class="value"> {{ form.khd||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                联行号：
              </div>
              <div class="value"> {{ form.khhNo||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                银行账号：
              </div>
              <div class="value"> {{ form.bankCard||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                基本存款账户编号：
              </div>
              <div class="value"> {{ form.jbckzhbm||'' }} </div>
            </div>
          </div>
        </el-collapse-item>
        <el-collapse-item title="发票信息" name="3">
          <div class="row">

            <div class="col">
              <div class="label">
                发票抬头：
              </div>
              <div class="value"> {{ form.invoceHeader||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                纳税人识别号：
              </div>
              <div class="value"> {{ form.invoceCreditCode||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                开户行：
              </div>
              <div class="value">{{form.invoceBankName}}</div>
            </div>
            <div class="col">
              <div class="label">
                银行账号：
              </div>
              <div class="value"> {{ form.invoceBankCard||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                单位注册地址：
              </div>
              <div class="value"> {{ form.invoceAddress||'' }} </div>
            </div>
            <div class="col">
              <div class="label">
                单位电话：
              </div>
              <div class="value"> {{ form.invoceDwdh||'' }} </div>
            </div>
          </div>
        </el-collapse-item>
        <el-collapse-item title="企业资质" name="4">
          <div class="row">
            <div class="col">
              <div class="label">
                营业执照照片：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.yyzz"
                  :preview-src-list="[form.yyzz]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                开户许可证：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.fhxkzPic"
                  :preview-src-list="[form.fhxkzPic]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                法人身份证正面：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.frSfzzm"
                  :preview-src-list="[form.frSfzzm]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                法人身份证反面：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.frSfzfm"
                  :preview-src-list="[form.frSfzfm]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                经办人身份证正面：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.jbrSfzzm"
                  :preview-src-list="[form.jbrSfzzm]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                经办人身份证反面：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.jbrSfzfm"
                  :preview-src-list="[form.jbrSfzfm]"
                />
              </div>
            </div>
          </div>
        </el-collapse-item>
        <el-collapse-item title="经营场所" name="5">
          <div class="row">
            <div class="col">
              <div class="label">
                门头全景照：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.mtqjzPic"
                  :preview-src-list="[form.mtqjzPic]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                办公照片：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.bgzp1Pic"
                  :preview-src-list="[form.bgzp1Pic]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                办公照片：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.bgzp2Pic"
                  :preview-src-list="[form.bgzp2Pic]"
                />
              </div>
            </div>
          </div>
        </el-collapse-item>
        <el-collapse-item title="补充材料" name="6">
          <div class="row">
            <div class="col">
              <div class="label">
                业务场景真实性承诺函：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.ywcjzsxcnh"
                  :preview-src-list="[form.ywcjzsxcnh]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                业务场景说明：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.ywcjsm"
                  :preview-src-list="[form.ywcjsm]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                法大大授权协议：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.fddsqxy"
                  :preview-src-list="[form.fddsqxy]"
                />
              </div>
            </div>
            <div class="col">
              <div class="label">
                特殊行业许可证：
              </div>
              <div class="value">
                <ImagePreview
                  :width="100"
                  :height="100"
                  :src="form.tshyxkz"
                  :preview-src-list="[form.tshyxkz]"
                />
              </div>
            </div>
          </div>
        </el-collapse-item>

      </el-collapse>
    </el-card>
  </div>
</template>

<script setup name="enterpriseDetail" lang="ts">
import api from '@/api/enterprise/addEnterprise';
import { addOrEditForm } from '@/api/enterprise/addEnterprise/types';

const { proxy } = getCurrentInstance() as ComponentInternalInstance;
const { pay_channel } = toRefs<any>(proxy?.useDict('pay_channel'));

const activeName = ref<Array<string|number>>(['1','2','3','4','5','6'])

const form = ref<addOrEditForm>({
  address: '',
  bankCard: '',
  bgzp1Pic: '',
  bgzp2Pic: '',
  fddsqxy: '',
  fhxkzPic: '',
  fr: '',
  frCardidBeginDate: '',
  frCardidEndDate: '',
  frSfz: '',
  frSfzfm: '',
  frSfzzm: '',
  frSjh: '',
  industry: '',
  invoceAddress: '',
  invoceBankCard: '',
  invoceBankName: '',
  invoceCreditCode: '',
  invoceDwdh: '',
  invoceHeader: '',
  jbckzhbm: '',
  jbrCardidBeginDate: '',
  jbrCardidEndDate: '',
  jbrSfzfm: '',
  jbrSfzzm: '',
  khd: '',
  khh: '',
  khhCode: '',
  khhNo: '',
  khm: '',
  mtqjzPic: '',
  name: '',
  nameNc: '',
  nsrSbh: '',
  passage: '',
  tshyxkz: '',
  unitArea: '',
  unitAreaName: '',
  wtr: '',
  wtrEmail: '',
  wtrSfz: '',
  wtrSjh: '',
  ywcjsm: '',
  ywcjzsxcnh: '',
  ywyId: '',
  yyzz: '',
  yyzzBeginDate: '',
  yyzzEndDate: '',
  yyzzTime: [],
  frCardidTime: [],
  jbrCardidTime: []
});

const route = useRoute();
/** 查询企业信息 */
const getInfoData = async () => {
  const res = await api.merchantDetail(merchantId.value);
  form.value = res.data;
  form.value.frCardidTime = form.value.frCardidBeginDate + '~' + form.value.frCardidEndDate;
  form.value.jbrCardidTime = form.value.jbrCardidBeginDate + '~' + form.value.jbrCardidEndDate;
  form.value.yyzzTime = form.value.yyzzBeginDate + '~' + form.value.yyzzEndDate;
};

const merchantId = ref<any>('');
onMounted(() => {
  if (route.query.id) {
    merchantId.value = route.query.id;
    getInfoData(); // 查询企业信息
  }
});
</script>

<style lang="scss" scoped>
</style>
